//引入二次封装的axios
import request from "@/utils/request";
import type { HospitalDetail, DeparmentResponseData, UserLoginResponeseData, LoginData, WxLoginResponseDate, HospitalWorkDate, DoctorResponseData,UserResponseData,DoctorInfoData} from './type'

enum API {
    HOSPITALDETAIL_URL = '/hosp/hospital/',
    // 获取某一个科室的数据
    HOSPITALDEPARMENT_URL = '/hosp/hospital/department/',
    // 获取验证码接口
    GETUSERCODE_URL = '/sms/send/',
    // 用户登录接口
    USERLOGIN_URL = '/user/login',
    // 微信扫码登录的参数接口
    WXLOGIN_URL = '/user/weixin/getLoginParam/',
    // 医院的科室预约挂号数据接口
    HOSPITALWORK_URL = '/hosp/hospital/auth/getBookingScheduleRule/',
    // 获取医院某个科室某一天响应的医生排班的数据接口
    HOSPITALDOCTOR_URL = '/hosp/hospital/auth/findScheduleList/',
    // 获取某个账号下就诊人的信息接口
    GETUSER_URL = '/user/patient/auth/findAll',
    // 获取挂号医生的信息接口
    GETDOCTOR_URL = '/hosp/hospital/getSchedule/'
}

// 获取医院详情的接口
export const reqHospitalDetail = (hoscode: string) => request.get<any, HospitalDetail>(API.HOSPITALDETAIL_URL + hoscode)
// 获取医院某一科室的数据接口
export const reqHospitalDeparment = (hoscode: string) => request.get<any, DeparmentResponseData>(API.HOSPITALDEPARMENT_URL + hoscode)
// 获取验证码接口
export const reqUserCode = (phone: string) => request.get<any, any>(API.GETUSERCODE_URL + phone)
// 获取用户登录接口
export const reqUserLogin = (data: LoginData) => request.post<any, UserLoginResponeseData>(API.USERLOGIN_URL, data)
// 获取微信扫码登录的参数
export const reqWxLogin = (wxRedirectUri: string) => request.get<any, WxLoginResponseDate>(API.WXLOGIN_URL + `?wxRedirectUri=${wxRedirectUri}`)
// 医院的科室预约挂号数据
export const reqHospitalWork = (page: number, limit: number, hoscode: string, depcode: string) => request.get<any, HospitalWorkDate>(API.HOSPITALWORK_URL + `${page}/${limit}/${hoscode}/${depcode}`)
// 获取医院某个科室某一天响应的医生排班的数据接口
export const reqHospitalDoctor = (hoscode:string,depcode:string,workDate:string) => request.get<any,DoctorResponseData>(API.HOSPITALDOCTOR_URL+`${hoscode}/${depcode}/${workDate}`)
//获取某个账号下就诊人的信息
export const reqGetUser = ()=> request.get<any,UserResponseData>(API.GETUSER_URL)
//获取挂号医生的信息
export const reqDoctorInfo = (scheduleId:string)=> request.get<any,DoctorInfoData>(API.GETDOCTOR_URL+scheduleId)